<?php

namespace App\Http\Resources\Article;

use App\Http\Resources\BaseResource;
use App\Models\Article\ArticleCategoryModel;

class ArticleCategoryDetailResource extends BaseResource
{
    public function toArray($request): array
    {
        return [
            "id"          => $this->id,
            "name"        => $this->name,
            "description" => $this->description,
            "cover"       => $this->cover,
            "type"        => $this->type,
            "sort"        => $this->sort,
            "typeText"    => ArticleCategoryModel::TYPE_TEXT[$this->type] ?? "-",
            "supportNum"  => $this->supportNum,
            "collectNum"  => $this->collectNum,
            "forwardNum"  => $this->forwardNum,
            "readNum"     => $this->readNum,
            "showNum"     => $this->showNum,
            "createdAt"   => formatDate($this->createdAt, "-"),
            "updatedAt"   => formatDate($this->updatedAt, "-")
        ];
    }
}
